define([], function() {
    'use strict';
    let _serverUrl = "./geoLocation";

    function init(serverUrl) {
        _serverUrl = serverUrl;
    }

    function getdata(code, callback) {
        let params = {
            index: code,
            // callback: function (res) {
            //     callback && callback(res);
            // }
        }
        return ajaxGeolocationgetdata(params);
    }


    function ajaxGeolocationgetdata(params) {
        let resdata = null;
        $.ajax({
            url: _serverUrl + "/rest/zq/queryChild/2020/" + params.index + "/1",
            type: "GET",
            dataType: "JSON",
            async: false,
            success: function (res) {
                resdata = res;
            },
            error: function (res) {
                console.error("获取数据失败！");
            },
        });
        return resdata;
    }

    return {
        init: init,
        getdata: getdata
    }

})